def matrix(n:int=1, m:int=None,  a:int=0) -> list:
    if not m:
        m = n
    l = [[a for _ in range(m)] for _1 in range(n)]
    return l


assert matrix() == [[0]]
assert matrix(3) == [[0, 0, 0], [0, 0, 0], [0, 0, 0]]
assert matrix(2, 3) == [[0, 0, 0], [0, 0, 0]]
assert matrix(3, 2, 1) == [[1, 1], [1, 1], [1, 1]]
assert matrix(a=7) == [[7]]
assert matrix(a=0.5, m=5, n=3) == [[0.5, 0.5, 0.5, 0.5, 0.5], [0.5, 0.5, 0.5, 0.5, 0.5], [0.5, 0.5, 0.5, 0.5, 0.5]]